#ifndef __AW_PHYSICAL_BODY
#define __AW_PHYSICAL_BODY

class AW_PhysicalBody : public AW_Body {
	
public:
	AW_PhysicalBody(Ontology *O,FTKBase *Memory);
	AW_PhysicalBody(FILE *fp,Ontology *O,FTKBase *Memory);

	virtual ~AW_PhysicalBody();

	virtual bool load(FILE *fp);
	virtual bool save(FILE *fp);

	virtual bool is_a(char *c);
	virtual bool is_a(Symbol *c);

	virtual void draw(void);
	virtual void draw_shadows(float lightpos[4]);

	virtual void actualize(float time,float timeinc,List<AW_Message> *message_queue);

	void set_ode_world(dWorldID id,dSpaceID space);	/* After this is set, all the physical objects are created. */ 

protected:
	List<C3DObject> parts;
	List<dBodyID> body_ID;
	List<dGeomID> geom_ID;
	List<dJointID> joint_ID;

	bool world_ID;
	dWorldID ode_world_ID;
	dSpaceID space;
	dJointGroupID jointgroup_ID;

	/* Structures to temporally save the information of the body shape: */ 
	List<char> tmp_part_file;
	List<Vector> tmp_part_pos;
	List<Quaternion> tmp_part_rot;
	List<Vector> tmp_part_linear_velocity;
	List<Vector> tmp_part_angular_velocity;
	List<char> tmp_part_geom;
	List<float> tmp_part_mass;

	List<char> tmp_joint_type;
	List<int> tmp_joint_p1;
	List<int> tmp_joint_p2;
	List<Vector> tmp_joint_vector;
	List<Vector> tmp_joint_anchor;

private:

}; /* AW_PhysicalBody */ 

#endif
